#! /bin/bash

echo "Install yasm  ..."
yum install yasm SDL* gtk+* -y

echo "Install nasm-2.13.03"
wget https://www.nasm.us/pub/nasm/releasebuilds/2.13.03/nasm-2.13.03.tar.gz
tar zxvf nasm-2.13.03.tar.gz
cd nasm-2.13.03
./configure && make && make install

echo "Install x264 ..."
cd ..
git clone https://code.videolan.org/videolan/x264.git
cd x264
./configure --enable-shared && make && make install
ldconfig

echo "Install ffmpeg ..."
cd ..
wget https://ffmpeg.org/releases/ffmpeg-4.2.2.tar.bz2
tar jxvf ffmpeg-4.2.2.tar.bz2
cd ffmpeg-4.2.2
./configure --enable-libx264 --enable-gpl && make && make install

echo "Clear install ..."
rm -rf ffmpeg-4.2.2 x264 nasm-2.13.03
rm -r nasm-2.13.03.tar.gz ffmpeg-4.2.2.tar.bz2
echo "Done."